/**
 * 总部销售单据数量单打印（预览）
 * @param data
 * @param isPreviewNum
 * @returns
 */
function quantityDocuments(data,isPreviewNum) {
	// 单据时间
	var time = data.orderTime.substring(0, 10);
	// 经手人
	var auditorName = data.auditorName;
	// 客户名称
	var clientName = data.clientName;
	// 单据类型
	var orderType = "";
	if (data.orderTypeNum == 0) {
		orderType = "销售数量单";
	} else if (data.orderTypeNum == 1) {
		orderType = "销售退货单";
	} else {
		orderType = "销售赠送单";
	}
	// 库房
	var storeName = data.storeName;
	// 取循环次数(打印页数）
	var counts = parseInt(data.products.length / 19);
	// 取余数
	var end = data.products.length % 19;
	// 总数
	var totalQ  = data.totalQ;
	// 单据总页数
	var pageNum = "";
	// 最后一页是否满18条
	if (end != 0) {
		pageNum = parseInt(counts) + 1;
		counts = counts + 1;
	} else {
		pageNum = parseInt(counts) + 1;
		counts = counts + 1;
	}

	var info = "";
	var pageInfo = "";
	for (i = 1; i <= counts; i++) {
		 if (i == counts) {
			var endInfo = "";
			var sum = 0;
			var infoEnd = data.products.slice((i-1) * 19, (i-1) * 19 + end);
			for (y = 0; y < infoEnd.length; y++) {

				info += "<tr><td>" + infoEnd[y].year + infoEnd[y].brand
						+ infoEnd[y].quarter + "</td><td>"
						+ infoEnd[y].productCode + infoEnd[y].color
						+ "</td><td>" + infoEnd[y].category + "</td><td>"
						+ infoEnd[y].unit + "</td><td>" + infoEnd[y].quantity
						+ "</td></tr>\n +"
			}
			info += "<tr><td>合计总数</td>  <td></td><td></td><td></td><td>"+ totalQ + "</td></tr>\n ";			
			pageInfo += "<tr><td><strong>共 " + pageNum +" 页   第 " + i + "页</strong></td></tr>\n" ;
		} else {			
			var sum = 0;
			var infoTwo = data.products.slice((i - 1) * 19, (i - 1) * 19 + 19);
			for (z = 0; z < infoTwo.length; z++) {
				info += "<tr><td>" + infoTwo[z].year + infoTwo[z].brand
						+ infoTwo[z].quarter + "</td><td>"
						+ infoTwo[z].productCode + infoTwo[z].color
						+ "</td><td>" + infoTwo[z].category + "</td><td>"
						+ infoTwo[z].unit + "</td><td>" + infoTwo[z].quantity
						+ "</td></tr>\n +"
			}									
			pageInfo += "<tr><td><strong>共 " + pageNum +" 页   第 " + i + "页</strong></td></tr>\n" ;			
		}
	}
	quantityPrint(pageInfo, orderType, storeName, time, auditorName,clientName, info,isPreviewNum);
}

/**
 * 总部销售单据数量单打印（预览）lodop方法
 * @param pageNum
 * @param page
 * @param orderType
 * @param storeName
 * @param time
 * @param auditorName
 * @param clientName
 * @param data
 * @param isPreviewNum
 * @returns
 */
function quantityPrint(pageInfo, orderType, storeName, time, auditorName,clientName, data,isPreviewNum) {

	LODOP.PRINT_INITA(5, 1, 1183, 600, "千禧总部——销售数量单小票打印");
	LODOP.SET_PRINT_PAGESIZE(1, 2100, 1400, "");
	//分页信息
	LODOP.ADD_PRINT_TABLE(10,660,791,25,"<style> table,td,th {border: 0px solid black; border-style: solid;border-collapse: collapse;font-size:13px;}  td{text-align:center;}</style>\n"
			+ "<table border='0'  ><tr><td>"+pageInfo+"</td></tr></table>");
	
	LODOP.ADD_PRINT_TEXT(12, 60, 846, 35, "千禧宝贝儿童服饰连锁 (" + orderType + ") (www.qxbaby.com)");
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	LODOP.SET_PRINT_STYLEA(0, "FontSize", 18);
	LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
	LODOP.ADD_PRINT_TEXT(48, 37, 842, 20, "      日期： " + time+ "        经手人：   " + auditorName + "             客户名称:    "+ clientName );
	LODOP.SET_PRINT_STYLEA(0,"Bold",1);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	//下划线
	LODOP.ADD_PRINT_LINE(66, 105, 66, 200, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	LODOP.ADD_PRINT_LINE(66, 270, 66, 370, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	LODOP.ADD_PRINT_LINE(66, 440, 66, 640, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 

	LODOP.ADD_PRINT_TABLE(69,55,824,365,"<style> table,td,th {border: 1px solid black; border-style: solid;border-collapse: collapse;font-size:13px;}  td{text-align:center;}</style>\n"
							+ "<table border='1'  width='700px'><tr><td style='width:300px;'>商品名称</td><td style='width:220px'>商品型号</td><td style='width:300px'>商品类型</td><td style='width:150px'>单位</td><td style='width:150px'>数量</td></tr>\n"
							+ data +"</table>");
	LODOP.ADD_PRINT_TEXT(442,56,841,20," 库房： " + storeName);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	LODOP.ADD_PRINT_TEXT(462,36,841,20,"    地址： 成都市荷花池大成市场二期A座6楼6号（总部）            电话： 028-83368588/83367588 （总部）       ");
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	//打印
	if(isPreviewNum){
		LODOP.PREVIEW();		
	}else{
		LODOP.PRINT();
	}
}

/**
 * 总部销售单据-价格单打印（预览）
 * @param data
 * @param isPreviewPrice
 * @returns
 */
function priceDocuments(data,isPreviewPrice) {
	// 单据时间
	var time = data.orderTime.substring(0, 10);
	// 经手人
	var auditorName = data.auditorName;
	// 客户名称
	var clientName = data.clientName;
	// 客户地区
	var clientArea = data.clientArea;
	// 单据类型
	var orderType = "";
	if (data.orderTypeNum == 0) {
		orderType = "销售单";
	} else if (data.orderTypeNum == 1) {
		orderType = "退货单";
	} else {
		orderType = "赠送单";
	}
	// 库房
	var storeName = data.storeName;
	// 取循环次数(打印页数）
	var counts = parseInt(data.products.length / 15);
	// 取余数
	var end = data.products.length % 15;
	// 单据总页数
	var pageNum = parseInt(counts) + 1;
	// 合计数量
	var amountTo = data.totalQ;
	// 合计金额
	var totalAmount = data.totalWholeSales;
	// 上欠
	var preAcctAmt = data.preAcctAmt;
	// 现金
	var cash = data.cash;
	// 优惠
	var totalDiscount = 0;
	// 下欠
	var postAcctAmt = data.postAcctAmt;
	//遍历信息
	var info = "";
	//分页信息
	var pageInfo = "";
	
	for (i = 1; i <= pageNum; i++) {

		if (i == pageNum) {
			// 没有余数,并且是最后一页,则总计单起一页
			if (end == 0 && i == pageNum) {				
				info += "<tr><td>总合计</td><td></td><td></td><td></td><td>"
						+ amountTo + "</td><td></td><td></td><td></td><td>"
						+ totalAmount + "</td></tr>\n" ;
				pageInfo +=	"<tr><td><strong>共 " + pageNum +" 页   第 " + i + "页</strong></td></tr>\n" ;								
			} else {				
				var sumNumber = 0;
				var sum = 0;
				var infoEnd = data.products.slice(counts * 15, counts * 15 + end);
				for (y = 0; y < infoEnd.length; y++) {
					info += "<tr><td>" + infoEnd[y].year + infoEnd[y].brand
							+ infoEnd[y].quarter + "</td><td>"
							+ infoEnd[y].productCode + infoEnd[y].color
							+ "</td><td>" + infoEnd[y].category + "</td><td>"
							+ infoEnd[y].unit + "</td><td>"
							+ infoEnd[y].quantity + "</td><td>"
							+ infoEnd[y].selectPrice + "</td><td>"
							+ infoEnd[y].discountRate + "</td><td>"
							+ infoEnd[y].wholeSales + "</td><td>"
							+ infoEnd[y].totalWholeSales + "</td></tr>\n"
					sumNumber += parseInt(infoEnd[y].quantity);
					sum += parseInt(infoEnd[y].totalWholeSales);
					// 最后一行算合计
					if (y == infoEnd.length - 1) {
						info +=  "</td></tr>\n"
							+ "<tr><td>单页合计</td><td></td><td></td><td></td><td>"
							+ sumNumber
							+ "</td><td></td><td></td><td></td><td>"
							+ sum + "</td></tr>\n";
						info += "</td></tr>\n"
								+ "<tr><td>总合计</td><td></td><td></td><td></td><td>"
								+ amountTo
								+ "</td><td></td><td></td><td></td><td>"
								+ totalAmount + "</td></tr>\n";
						pageInfo +=	"<tr><td><strong>共 " + pageNum +" 页   第 " + i + "页</strong></td></tr>\n" ;		
					}
				}							
			}

		} else {			
			var sumNumber = 0;
			var sum = 0;
			var infoTwo = data.products.slice((i - 1) * 15, (i - 1) * 15 + 15);
			for (z = 0; z < infoTwo.length; z++) {
				info += "<tr><td>" + infoTwo[z].year + infoTwo[z].brand
						+ infoTwo[z].quarter + "</td><td>"
						+ infoTwo[z].productCode + infoTwo[z].color
						+ "</td><td>" + infoTwo[z].category + "</td><td>"
						+ infoTwo[z].unit + "</td><td>" + infoTwo[z].quantity
						+ "</td><td>" + infoTwo[z].selectPrice + "</td><td>"
						+ infoTwo[z].discountRate + "</td><td>"
						+ infoTwo[z].wholeSales + "</td><td>"
						+ infoTwo[z].totalWholeSales + "</td></tr>\n + "
				sumNumber += parseInt(infoTwo[z].quantity);
				sum += parseInt(infoTwo[z].totalWholeSales);
				// 最后一行算合计
				if (z == infoTwo.length - 1) {
					info +=  "</td></tr>\n"
						+ "<tr><td>单页合计</td><td></td><td></td><td></td><td>"
						+ sumNumber
						+ "</td><td></td><td></td><td></td><td>"
						+ sum + "</td></tr>\n";
					pageInfo +=	"<tr><td><strong> 共" + pageNum +" 页   第 " + i + "页</strong></td></tr>\n" ;		
				}
			}					
		}
	}
	pricePrint(pageInfo, orderType, clientArea, storeName, time,auditorName, clientName, info, preAcctAmt, cash,totalDiscount, postAcctAmt,isPreviewPrice);
}

/**
 * 价格单据打印输出方法
 * @param pageNum
 * @param page
 * @param orderType
 * @param clientArea
 * @param storeName
 * @param time
 * @param auditorName
 * @param clientName
 * @param data
 * @param preAcctAmt
 * @param cash
 * @param totalDiscount
 * @param postAcctAmt
 * @param isPreviewPrice
 * @returns
 */
function pricePrint(pageInfo, orderType, clientArea, storeName, time,
		auditorName, clientName, data, preAcctAmt, cash, totalDiscount,
		postAcctAmt,isPreviewPrice) {

	LODOP.PRINT_INITA(5, 1, 1183, 600, "千禧总部——销售价格单小票打印");
	LODOP.SET_PRINT_PAGESIZE(1, 2100, 1400, "");
	LODOP.SET_PRINT_MODE("PRINT_NOCOLLATE", 1);
	LODOP.ADD_PRINT_TEXT(4, 144, 100, 33, orderType);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	LODOP.SET_PRINT_STYLEA(0, "FontSize", 19);
	LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
	LODOP.ADD_PRINT_TEXT(9, 255, 408, 27, " 千禧宝贝品牌儿童服饰连锁(www.qxbaby.com)");
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	LODOP.SET_PRINT_STYLEA(0, "FontSize", 10);
	//分页信息
	LODOP.ADD_PRINT_TABLE(11,678,116,23,"<style> table,td,th {border: 0px solid black; border-style: solid;border-collapse: collapse;font-size:13px;}  td{text-align:center;}</style>\n"
			+ "<table border='0'  ><tr><td>"+pageInfo+"</td></tr></table>");
		
	LODOP.ADD_PRINT_TEXT(47, 35, 758, 25, "      日期： " + time + "        经手人：   " + auditorName + "           客户名称:      "+ clientName);
	LODOP.SET_PRINT_STYLEA(0,"Bold",1);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	//下划线
	LODOP.ADD_PRINT_LINE(75, 105, 75, 200, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	LODOP.ADD_PRINT_LINE(75, 250, 75, 350, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	LODOP.ADD_PRINT_LINE(75, 440, 75, 710, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	LODOP.ADD_PRINT_TABLE(68,35,824,300,"<style> table,td,th {border: 1px solid black; border-style: solid;border-collapse: collapse;font-size:13px;}  td{text-align:center;}</style>\n"
							+ "<table border='1'  width='720px'><thead><tr><td style='width:110px;'>商品名称</td><td style='width:70px'>商品型号</td><td style='width:100px'>商品类型</td><td style='width:40px'>单位</td><td style='width:30px'>数量</td><td style='width:40px'>单价</td><td style='width:30px'>折扣</td><td style='width:50px'>折后价</td><td style='width:60px'>折后金额</td></tr></thead>\n"
							+ data + "</table>");
	LODOP.ADD_PRINT_TEXT(430, 38, 323, 20, "   地址： 成都市荷花池大成市场二期A座6楼6号（总部） ");
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	LODOP.ADD_PRINT_TEXT(449, 38, 277, 20, "   电话： 028-83368588/83367588 （总部）");
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	LODOP.ADD_PRINT_TEXT(455, 458, 341, 20, "换货需齐码，包装齐全；且当季，否则不予退换");
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	LODOP.SET_PRINT_STYLEA(0, "FontSize", 10);
	LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
	//上欠
	LODOP.ADD_PRINT_TEXT(385, 86, 69, 20,"上欠金额：                               ");
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1);  
	// 上欠
	LODOP.ADD_PRINT_TEXT(386, 149, 100, 20, preAcctAmt); 
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	// 上欠金额
	LODOP.ADD_PRINT_LINE(407, 140, 407, 190, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	//优惠
	LODOP.ADD_PRINT_TEXT(415, 87, 52, 20,"优惠：   ");
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	// 优惠
	LODOP.ADD_PRINT_TEXT(416, 154, 100, 20, totalDiscount); 
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	// 优惠下划线
	LODOP.ADD_PRINT_LINE(433, 122, 433, 220, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	//现收金额
	LODOP.ADD_PRINT_TEXT(420, 351, 75, 20, "现收金额：");
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	// 现金
	LODOP.ADD_PRINT_TEXT(421, 444, 100, 20, cash); 
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	//现收金额下划线
	LODOP.ADD_PRINT_LINE(438, 410, 438, 510, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	// 总欠金额	
	LODOP.ADD_PRINT_TEXT(400, 350, 75, 20, "总欠金额:");
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	//总欠金额
	LODOP.ADD_PRINT_TEXT(401, 430, 100, 20, postAcctAmt); 
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1);	
	//总金额下划线
	LODOP.ADD_PRINT_LINE(420, 410, 420, 510, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	
	//库房
	LODOP.ADD_PRINT_TEXT(408, 581, 55, 20, "库房：");
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	//库房
	LODOP.ADD_PRINT_TEXT(409, 636, 100, 20, storeName);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	//库房
	LODOP.ADD_PRINT_LINE(426, 615, 426, 700, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
		
	//地区
	LODOP.ADD_PRINT_TEXT(438, 581, 55, 20, "地区：");
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	//地区
	LODOP.ADD_PRINT_TEXT(440, 632, 100, 20, clientArea);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	//地区下划线
	LODOP.ADD_PRINT_LINE(456, 615, 456, 700, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
		
	if(isPreviewPrice){
		LODOP.PREVIEW(); 
	}else{
		LODOP.PRINT();
	}	
}

/**
 * 总部PDA单据打印
 * @param data
 * @returns
 */
function printPDA(data) {
	// 客户
	var custName = data.custName;
	// 经手人
	var enterUserName = data.enterUserName;
	// 总数
	var sum = data.numberSum;
	// 客户地区
	var orderTime = data.orderTime;
	// 公司备注
	var hqComment = data.hqComment;
	// 客户备注
	var customComment = data.customComment;
	//备注信息
	var comment = "公司备注：" + hqComment + "/ 客户备注：" +  customComment;
	// 取循环次数(打印页数）
	var counts = parseInt(data.pdAproductVOs.length / 15);
	// 取余数
	var end = data.pdAproductVOs.length % 15;
	// 单据总页数
	var pageNum = 0;
	if (end == 0) {
		pageNum = parseInt(counts);
	} else {
		pageNum = parseInt(counts) + 1;
	}
	for (i = 1; i <= pageNum; i++) {
		var info = "";

		var pdaInfo = data.pdAproductVOs.slice((i - 1) * 15, (i - 1) * 15 + 15)

		for (t = 0; t < pdaInfo.length; t++) {
			info += "<tr><td>" + pdaInfo[t].sortId + "</td>" + "<td>" + pdaInfo[t].year +"</td>" + "<td>" + pdaInfo[t].brand +"</td>"
					+ "<td>" + pdaInfo[t].categoryName + "</td>" + "<td>"
					+ pdaInfo[t].productCode + "</td>" + "<td>"
					+ pdaInfo[t].productIdentity + "</td>" + "<td>"
					+ pdaInfo[t].color + "</td>" + "<td>"
					+ pdaInfo[t].number + "</td>" + "<td>"
					+ pdaInfo[t].inventoryNum + "</td></tr>";
		}
		if (i == pageNum) {
			info += "<tr><td>总数</td><td></td><td></td><td></td><td></td><td></td><td>" + sum
					+ "</td><td></td></tr>";
			padDetails(custName, enterUserName,comment, orderTime, info, pageNum, i);
		}else{
			padDetails(custName, enterUserName,comment, orderTime, info, pageNum, i);
			console.log("PDA打印完成！")
		}
	}
}

function padDetails(custName, enterUserName,comment, time, info, pageNum, nowPage) {
	LODOP.PRINT_INITA(5, 1, 1183, 600, "千禧总部——PDA销售打印");
	LODOP.SET_PRINT_PAGESIZE(1, 2100, 1400, "");
	LODOP.SET_PRINT_MODE("PRINT_NOCOLLATE", 1);
	LODOP.SET_PRINT_STYLEA(0, "FontSize", 22);
	LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
	LODOP.ADD_PRINT_TEXT(11, 325, 408, 27, " PDA单据");
	LODOP.SET_PRINT_STYLEA(0, "FontSize", 13);
	LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
	LODOP.SET_PRINT_STYLEA(0, "FontSize", 10);
	LODOP.ADD_PRINT_TEXT(37, 55, 758, 25, "客户:");
	LODOP.ADD_PRINT_LINE(55, 90, 55, 280, 0, 0);
	LODOP.ADD_PRINT_TEXT(37, 100, 758, 25, custName);
	LODOP.ADD_PRINT_TEXT(37, 300, 758, 25, "PDA录入:");
	LODOP.ADD_PRINT_LINE(55, 350, 55, 450, 0, 0);
	LODOP.ADD_PRINT_TEXT(37, 360, 758, 25, enterUserName);
	LODOP.ADD_PRINT_TEXT(37, 470, 758, 25, "时间:");
	LODOP.ADD_PRINT_LINE(55, 510, 55, 670, 0, 0);
	LODOP.ADD_PRINT_TEXT(37, 520, 758, 25, time);
	if(comment != null){
		LODOP.ADD_PRINT_TEXT(72, 45, 400, 25, "备注:");
		LODOP.ADD_PRINT_LINE(85, 105, 85, 470, 0, 0);
		LODOP.SET_PRINT_STYLEA(0, "FontSize", 18);
		LODOP.ADD_PRINT_TEXT(72, 125, 758, 25, comment);
	}
	
	LODOP.ADD_PRINT_TABLE(100,1,524,405,"<style> table,td,th {border: 1px solid black; border-style: solid;border-collapse: collapse;font-size:13px;}  td{text-align:center;}</style>\n"
							+ "<table border='1'  width='760px'><tr><td style='width:50px;'>编号</td><td style='width:40px'>年份</td><td style='width:100px'>品牌</td><td style='width:110px'>商品类型</td><td style='width:90px'>货号</td><td style='width:90px'>公司货号</td><td style='width:40px'>颜色</td><td style='width:40px'>数量</td><td style='width:40px'>库存</td></tr>\n"
							+ info + "</table>");
	LODOP.ADD_PRINT_TEXT(11, 648, 116, 23, "共" + pageNum + "页 -  第" + nowPage + "页      ");
	LODOP.PRINT();
	//LODOP.PREVIEW();
}

/**
 * 总部财务 - 客户财务单据（收款单）- 打印预览
 * @param isView true:预览 false:直接打印
 * @param orderId 单据id
 * @returns
 */
function printCustDocument(isView,date){
	LODOP.PRINT_INITA(5, 1, 1183, 600, "千禧总部——收款单打印");
	LODOP.SET_PRINT_PAGESIZE(1, 2100, 1400, "");
	LODOP.SET_PRINT_MODE("PRINT_NOCOLLATE", 1);
	LODOP.ADD_PRINT_TEXT(4, 114, 100, 33, date.type);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	LODOP.SET_PRINT_STYLEA(0, "FontSize", 19);
	LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
	LODOP.ADD_PRINT_TEXT(9, 225, 408, 27, " 千禧宝贝品牌儿童服饰连锁(www.qxbaby.com)");
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	LODOP.SET_PRINT_STYLEA(0, "FontSize", 10);
	LODOP.ADD_PRINT_TEXT(47, 5, 758, 25, "      日期： " + date.billDate +  "           客户名称:   "+ date.cust  +  "             地区：   " + date.area  );
	LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	LODOP.ADD_PRINT_LINE(75, 75, 75, 170, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	LODOP.ADD_PRINT_LINE(75, 265, 75, 390, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	LODOP.ADD_PRINT_LINE(75, 430, 75, 680, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	
	LODOP.ADD_PRINT_TEXT(80, 5, 758, 25, "  	上欠金额： " + date.preAcctAmt + "          下欠金额:      "+ date.postAcctAmt   );
	LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	LODOP.ADD_PRINT_LINE(103, 75, 103, 170, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	LODOP.ADD_PRINT_LINE(103, 265, 103, 390, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	
	LODOP.ADD_PRINT_TEXT(113, 5, 758, 25, "  	现收金额： " + date.invoiceTotal +  "               优惠金额:      "+ date.invoiceDiscount   );
	LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	LODOP.ADD_PRINT_LINE(133, 75, 133, 170, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	LODOP.ADD_PRINT_LINE(133, 265, 133, 390, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
		
	var info = "";
	let items = date.items;

	for (i = 0; i < items.length; i++) {
		var sort = i+1;			
		info += "<tr><td>" + sort + "</td>" 
		+ "<td>" + items[i].financeCategory + "</td>" + "<td>"
		+ items[i].total  + "</td>" + "<td>"				
		+ items[i].comment  + "</td></tr>";		
	}
	
	info  += "<tr><td></td>" 
	+ "<td><b>总合计：</b></td>" + "<td><b>"
	+ date.invoiceTotal  + "</b></td><td></td></tr>";	
	
	LODOP.ADD_PRINT_TABLE(110,1,524,320,"<style> table,td,th {border: 1px solid black; border-style: solid;border-collapse: collapse;font-size:13px;}  td{text-align:center;}</style>\n"
			+ "<table border='1'  width='760px'><thead><tr><td colspan='4' align='center'><b>现收金额明细</b></td></tr><tr><td style='width:100px;'><b>序号</b></td><td style='width:210px'><b>账户名称</b></td><td style='width:180px'><b>金额</b></td><td style='width:270px'><b>备注</b></td></tr></thead>\n"
			+ info + "</table>");
		
	LODOP.ADD_PRINT_TEXT(440, 5, 758, 25, "  	  经手人： " + date.creator +  "                审核人:        "+ date.creator   );
	LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	//经手人下划线
	LODOP.ADD_PRINT_LINE(465, 75, 465, 170, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	//审核人下划线
	LODOP.ADD_PRINT_LINE(465, 260, 465, 390, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
		
	LODOP.ADD_PRINT_TEXT(473, 5, 758, 25, "   地址： " + "   成都市荷花池大成市场二期A座6楼6号(总部)" );
	LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	
	LODOP.ADD_PRINT_LINE(500, 65, 500, 390, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	
	LODOP.ADD_PRINT_TEXT(505, 5, 758, 25,  "   电话:   " + "   028-83368588/83367588 (总部) 83368987(配货中心)"   );
	LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
	
	LODOP.ADD_PRINT_LINE(530, 65, 530, 390, 0, 0);
	LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);  
	LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1); 
		
	if(isView){
		LODOP.PREVIEW();
	}else{
		LODOP.PRINT();
	}
}
